
$(document).ready(function() {

	chrome.storage.local.get('settings', function (args) {
		if (args.settings != undefined && args.settings.stopAutoPlay != undefined) {
			$('input').prop('checked', args.settings.stopAutoPlay);
		} else {
			chrome.storage.local.set({'settings': {'stopAutoPlay': true}}, function (){});
			$('input').checked = true;
		}
	});

	$('input').click(function() {
		var checked = $(this).prop('checked');
		chrome.storage.local.set({'settings': {'stopAutoPlay': checked}}, function () {
		});
	});

});